package com.lxyk.service.student.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lxyk.dao.student.RefundDao;

import com.lxyk.domain.StudentVO2;
import com.lxyk.service.student.RefundService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class RefundServiceImpl implements RefundService {

    @Autowired
    private RefundDao refundDao;

    @Override
    public void addRefund(StudentVO2 student) {
        refundDao.addRefund(student);
    }

    @Override
    public void updateRefund(StudentVO2 student) {
        refundDao.updateRefund(student);
    }

    @Override
    public PageInfo<StudentVO2> refundByCid(Integer cid, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<StudentVO2> list = refundDao.refundByCid(cid);
        return new PageInfo<>(list);
    }

    @Override
    public PageInfo<StudentVO2> findRefundByCondition(StudentVO2 vo, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<StudentVO2> list = refundDao.findRefundByCondition(vo);
        return new PageInfo<>(list);
    }

    @Override
    public StudentVO2 findRefundById(Integer id) {
        return refundDao.findRefundById(id);
    }

    @Override
    public int findCountByCid(Integer cid) {
        return refundDao.findCountByCid(cid);
    }

    @Override
    public void updateStudent(StudentVO2 student) {
        refundDao.updateStudent(student);
    }

}
